package com.donggua.aichebao.commonui.info;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.donggua.aichebao.commonui.R;

/**
 * Created by Administrator on 2017-08-06.
 */
//com.donggua.aichebao.commonui.info.SpecialInfoItemLayout
public class SpecialInfoItemLayout extends LinearLayout {
    private InfoItemLayoutOperator infoItemLayout;
    public SpecialInfoItemLayout(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        this.setOrientation(LinearLayout.HORIZONTAL);

        this.setGravity(Gravity.CENTER_VERTICAL);
        int specalMargin =(int)context.getResources().getDimension(R.dimen.specalMargin);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                           ViewGroup.LayoutParams.WRAP_CONTENT);
        TextView textView = new TextView(context);
        textView.setText("*");
        textView.setTextColor(0xffff0000);
        textView.setGravity(Gravity.CENTER);
        textView.setBackgroundColor(0x7700ffff);
        textView.setTextSize( TypedValue.COMPLEX_UNIT_PX,30);
        layoutParams.rightMargin =specalMargin;
        textView.setLayoutParams(layoutParams);
        this.addView(textView);
        layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        RelativeLayout relativeLayout = new RelativeLayout(context);
        infoItemLayout = new InfoItemLayoutOperator(context,attrs,relativeLayout);
        relativeLayout.setLayoutParams(layoutParams);
        this.addView(relativeLayout);

    }
}
